package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.LuntaiRequestTyre;
import com.ruoyi.system.service.ILuntaiRequestTyreService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 申请的轮子信息Controller
 * 
 * @author ruoyi
 * @date 2025-02-17
 */
@RestController
@RequestMapping("/system/requestTyre")
public class LuntaiRequestTyreController extends BaseController
{
    @Autowired
    private ILuntaiRequestTyreService luntaiRequestTyreService;

    /**
     * 查询申请的轮子信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:tyre:list')")
    @GetMapping("/list")
    public TableDataInfo list(LuntaiRequestTyre luntaiRequestTyre)
    {
        startPage();
        List<LuntaiRequestTyre> list = luntaiRequestTyreService.selectLuntaiRequestTyreList(luntaiRequestTyre);
        return getDataTable(list);
    }

    /**
     * 导出申请的轮子信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:tyre:export')")
    @Log(title = "申请的轮子信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LuntaiRequestTyre luntaiRequestTyre)
    {
        List<LuntaiRequestTyre> list = luntaiRequestTyreService.selectLuntaiRequestTyreList(luntaiRequestTyre);
        ExcelUtil<LuntaiRequestTyre> util = new ExcelUtil<LuntaiRequestTyre>(LuntaiRequestTyre.class);
        util.exportExcel(response, list, "申请的轮子信息数据");
    }

    /**
     * 获取申请的轮子信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:tyre:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(luntaiRequestTyreService.selectLuntaiRequestTyreById(id));
    }

    /**
     * 新增申请的轮子信息
     */
    @PreAuthorize("@ss.hasPermi('system:tyre:add')")
    @Log(title = "申请的轮子信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody LuntaiRequestTyre luntaiRequestTyre)
    {
        return toAjax(luntaiRequestTyreService.insertLuntaiRequestTyre(luntaiRequestTyre));
    }

    /**
     * 修改申请的轮子信息
     */
    @PreAuthorize("@ss.hasPermi('system:tyre:edit')")
    @Log(title = "申请的轮子信息", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody LuntaiRequestTyre luntaiRequestTyre)
    {
        return toAjax(luntaiRequestTyreService.updateLuntaiRequestTyre(luntaiRequestTyre));
    }

    /**
     * 删除申请的轮子信息
     */
    @PreAuthorize("@ss.hasPermi('system:tyre:remove')")
    @Log(title = "申请的轮子信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(luntaiRequestTyreService.deleteLuntaiRequestTyreByIds(ids));
    }
}
